Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup handling of KAFKA_VERSION env var in tests #1887

Merged
merged 1 commit into from
Aug 22, 2019

Conversation

jeffwidman
Copy link
Collaborator

@jeffwidman jeffwidman commented Aug 22, 2019

Now that we are using pytest, there is no need for a custom decorator
because we can use pytest.mark.skipif().

This makes the code significantly simpler. In particular, dropping the
custom @kafka_versions() decorator is necessary because it uses
func.wraps() which doesn't play nice with pytest fixtures:

So this is a pre-requisite to migrating some of those tests to using pytest fixtures.


This change is Reviewable

@jeffwidman jeffwidman force-pushed the simplify-version-checking-using-pytest-skipif branch from 9756d51 to 778acbc Compare August 22, 2019 04:40
Now that we are using `pytest`, there is no need for a custom decorator
because we can use `pytest.mark.skipif()`.

This makes the code significantly simpler. In particular, dropping the
custom `@kafka_versions()` decorator is necessary because it uses
`func.wraps()` which doesn't play nice with `pytest` fixtures:
- pytest-dev/pytest#677
- https://stackoverflow.com/a/19614807/770425

So this is a pre-requisite to migrating some of those tests to using
pytest fixtures.
@jeffwidman jeffwidman force-pushed the simplify-version-checking-using-pytest-skipif branch from 778acbc to bc87474 Compare August 22, 2019 08:25
from test.service import ExternalService, SpawnedService

log = logging.getLogger(__name__)


def random_string(length):
return "".join(random.choice(string.ascii_letters) for i in range(length))
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had to move this out of this file, at least for now, to solve a circular import problem. That wasn't present in the original version of working on this, likely because I'd already deleted a ton of code related to Simple* code paths... so it can be moved back later if semantically better here. But for now simplest to move it out to solve the import problem.

@jeffwidman jeffwidman merged commit 98c0058 into master Aug 22, 2019
@jeffwidman jeffwidman deleted the simplify-version-checking-using-pytest-skipif branch August 22, 2019 08:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant